﻿﻿
using System.Collections.Generic;
public class GameDebugInfo
{
    public LogicServerInfo logicServerInfo;
    public Dictionary<string,BattleServerInfo> battleServerInfo = new Dictionary<string, BattleServerInfo>();
    public override string ToString()
    {
        return $"LogicServerInfo:<br/>{TabStr()}{logicServerInfo}<br/><br/><br/><br/>BattleServerInfo:<br/>{TabStr()}{battleServerInfo.GetDictStr(true)}";
    }
    public static string TabStr()
    {
        return "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    }

}

public class LogicServerInfo
{
    public List<LogicServerUserInfo> onlineUsers;
    public List<RoomInfo> matchingRooms;

    public override string ToString()
    {
        string space = GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr();
        string logicNumInfo = $"Logic server online users count : {onlineUsers?.Count}{space}matching rooms count : {matchingRooms?.Count}\n\n";
        return $"{logicNumInfo}<br/><br/>onlineUsers:<br/>{GameDebugInfo.TabStr()+ GameDebugInfo.TabStr()}{onlineUsers.GetListStr(true)}<br/>{GameDebugInfo.TabStr()}matchingRooms:<br/>{GameDebugInfo.TabStr()+GameDebugInfo.TabStr()}{matchingRooms.GetListStr(true)}";
    }
}

public class BattleServerInfo
{
    public string serverIp;
    public List<ServerUserInfo> onlineUsers;
    public List<BattleRoomInfo> battleRooms;

    public override string ToString()
    {
        string space = GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr();
        string battleNumInfo = $"\n\nBattle server online users count : {onlineUsers?.Count}{space}battle rooms count : {battleRooms?.Count}\n\n";


        return $"{battleNumInfo}<br/><br/>onlineUsers:<br/>{GameDebugInfo.TabStr()+ GameDebugInfo.TabStr()}{onlineUsers.GetListStr(true)}<br/>{GameDebugInfo.TabStr()}BattleRooms:<br/>{battleRooms.GetListStr(true)}";
    }
}
public class ServerUserInfo
{
    public long id;
    public long clientId;

    public override string ToString()
    {
        return $"[id:{id}  clientId:{clientId}]";
    }
}
public class LogicServerUserInfo: ServerUserInfo
{
    public string uuid;
    public string nick;
    public int power;
    public int lv;
    public int battle_times;
    public int diamond;

    public override string ToString()
    {
        return $"[id:{id} nick:{nick} power:{power} battle_times:{battle_times} diamond:{diamond}]";
    }
}
public class RoomInfo
{
    public string battleId;
    public List<RoomUserInfo> team1;
    public List<RoomUserInfo> team2;

    public override string ToString()
    {
        return $"battleId : {battleId},<br/>{GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr()}team1 : {team1.GetListStr()}<br/>{GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr()}team2 : {team2.GetListStr()}<br/>";
    }
}
public class BattleRoomInfo
{
    public string battleId;
    public List<BattleUserInfo> team1;
    public List<BattleUserInfo> team2;

    public override string ToString()
    {
        return $"{GameDebugInfo.TabStr() + GameDebugInfo.TabStr()}battleId : {battleId},<br/>{GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr()}team1 : {team1.GetListStr()}<br/>{GameDebugInfo.TabStr() + GameDebugInfo.TabStr() + GameDebugInfo.TabStr()}team2 : {team2.GetListStr()}<br/>";
    }
}
public class RoomUserInfo
{
    public long id;
    public string nick;
    public int power;
    public int roleId;
    public override string ToString()
    {
        return $"[id:{id} nick:{nick} power:{power} roleId:{roleId}]";
    }
}

public class BattleUserInfo : RoomUserInfo
{
    public int aiLevel;
    public int memberId;

    public override string ToString()
    {
        return $"[id:{id} nick:{nick} power:{power} roleId:{roleId}  aiLevel:{aiLevel} memberId:{memberId}]";
    }
}